﻿using System;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;

namespace SimpleServiceBus.Bus.MessageManagement.Serialization
{
    public class BinaryMessageSerializer : IMessageSerializer
    {
        private readonly BinaryFormatter _binaryFormatter = new BinaryFormatter();

        #region IMessageSerializer Members

        public void Serialize(object message, Stream stream)
        {
            _binaryFormatter.Serialize(stream, message);
        }

        public object Deserialize(Stream stream)
        {
            return _binaryFormatter.Deserialize(stream);
        }

        #endregion

        public void Initialize(params Type[] types)
        {
        }
    }
}